//
//  RwdcomposeButton.swift
//  Weibo_rwd
//
//  Created by 任文迪 on 16/7/17.
//  Copyright © 2016年 spaceX. All rights reserved.
//

import UIKit

class RwdcomposeButton: UIButton {
    
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    private func setupUI() {
        
        self.titleLabel?.textAlignment = .Center
        self.titleLabel?.font = UIFont.systemFontOfSize(15)
        self.setTitleColor(UIColor.grayColor(), forState: .Normal)
        
    }
    
    override var highlighted: Bool {
        
        get{
            
            return false
        }
        
        set{
            
            
        }
    }
    //重新布局button
    override func layoutSubviews() {
        super.layoutSubviews()
        //设置子控件的宽高
        imageView?.y = 0
        imageView?.width = self.width
        imageView?.height = self.width
        //titleLabel在下面
        titleLabel?.x = 0
        titleLabel?.y = (imageView?.width)!
        titleLabel?.width = (imageView?.width)!
        titleLabel?.height = self.height - (imageView?.width)!
        
    }
    
}
